<template>
<div>
    <h1>排房添加</h1>
    <table class="table">
        <tr>
            <td>房型名称</td>
            <td><input type="text" v-model="data.fangname"></td>
        </tr>

        <tr>
            <td>房号</td>
            <td><input type="text" v-model="data.fangH"></td>
        </tr>

        <tr>
            <td></td>
            <td><input type="button" value="添加" @click="Add()"></td>
        </tr>

    </table>
</div>

</template>

<script setup lang="ts">
import {ref,onMounted} from 'vue';
import axios from 'axios';
import { useRouter } from 'vue-router';
const router=useRouter()

const data=ref({
  "bid": 0,
  "fangname": "",
  "fangH": ""
})


const Add=()=>{
   
    axios.post("/api/BaiFang/BaiAdd",data.value).then(res=>{
        if(res.data>0){
            alert("添加成功");
            router.push("/BShow")
        }else{
            alert("添加失败");
        }
    })
}


        
</script>

<style lang="scss" scoped>

</style>